/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import com.buanalintas.bynga.entities.MasterUser;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author user
 */
@Entity
@Table(name = "pos_transaction_mk_receipt_production")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findAll", query = "SELECT p FROM PosTransactionMkReceiptProduction p"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findBySync", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.sync = :sync"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptId", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptId = :receiptId"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptDate", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptDate = :receiptDate"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptNumber", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptNumber = :receiptNumber"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptTotal", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptTotal = :receiptTotal"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptQuantity", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptQuantity = :receiptQuantity"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptPaid", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptPaid = :receiptPaid"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptUnpaid", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptUnpaid = :receiptUnpaid"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptKeel", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptKeel = :receiptKeel"),
//    @NamedQuery(name = "PosTransactionMkReceiptProduction.findByReceiptTimestamp", query = "SELECT p FROM PosTransactionMkReceiptProduction p WHERE p.receiptTimestamp = :receiptTimestamp")})
public class PosTransactionMkReceiptProduction implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "receipt_id")
    private Integer receiptId;
    @Column(name = "receipt_date")
    @Temporal(TemporalType.DATE)
    private Date receiptDate;
    @Column(name = "receipt_number")
    private String receiptNumber;
    @Column(name = "receipt_total")
    private BigDecimal receiptTotal;
    @Column(name = "receipt_quantity")
    private BigDecimal receiptQuantity;
    @Column(name = "receipt_paid")
    private BigDecimal receiptPaid;
    @Column(name = "receipt_unpaid")
    private BigDecimal receiptUnpaid;
    @Column(name = "receipt_keel")
    private String receiptKeel;
    @Lob
    @Column(name = "receipt_description")
    private String receiptDescription;
    @Column(name = "receipt_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date receiptTimestamp;
   @JoinColumn(name = "receipt_user_id", referencedColumnName = "user_id")
    @ManyToOne
    private MasterUser receiptUserId;
    @JoinColumn(name = "receipt_unit_id", referencedColumnName = "unit_id")
    @ManyToOne
    private MasterUnit receiptUnitId;
    @JoinColumn(name = "receipt_pos_unit_id", referencedColumnName = "unit_id")
    @ManyToOne
    private PosMasterUnit receiptPosUnitId;
    @JoinColumn(name = "receipt_regional_id", referencedColumnName = "regional_id")
    @ManyToOne(optional = false)
    private PosMasterRegional receiptRegionalId;
//    @JoinColumn(name = "receipt_request_id", referencedColumnName = "request_id")
//    @ManyToOne(optional = false)
//    private PosTransactionMkRequestMaterialToWarehouse receiptRequestId;
    @JoinColumn(name = "receipt_work_order_id", referencedColumnName = "work_order_id")
    @ManyToOne(optional = false)
    private PosTransactionMkWorkOrder receiptWorkOrderId;
    
    public PosTransactionMkReceiptProduction() {
    }

    public PosTransactionMkReceiptProduction(Integer receiptId) {
        this.receiptId = receiptId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getReceiptId() {
        return receiptId;
    }

    public void setReceiptId(Integer receiptId) {
        this.receiptId = receiptId;
    }

    public Date getReceiptDate() {
        return receiptDate;
    }

    public void setReceiptDate(Date receiptDate) {
        this.receiptDate = receiptDate;
    }

    public String getReceiptNumber() {
        return receiptNumber;
    }

    public void setReceiptNumber(String receiptNumber) {
        this.receiptNumber = receiptNumber;
    }

    public String getReceiptKeel() {
        return receiptKeel;
    }

    public void setReceiptKeel(String receiptKeel) {
        this.receiptKeel = receiptKeel;
    }

    public String getReceiptDescription() {
        return receiptDescription;
    }

    public void setReceiptDescription(String receiptDescription) {
        this.receiptDescription = receiptDescription;
    }

    public Date getReceiptTimestamp() {
        return receiptTimestamp;
    }

    public void setReceiptTimestamp(Date receiptTimestamp) {
        this.receiptTimestamp = receiptTimestamp;
    }

    public BigDecimal getReceiptTotal() {
        return receiptTotal;
    }

    public void setReceiptTotal(BigDecimal receiptTotal) {
        this.receiptTotal = receiptTotal;
    }

    public BigDecimal getReceiptQuantity() {
        return receiptQuantity;
    }

    public void setReceiptQuantity(BigDecimal receiptQuantity) {
        this.receiptQuantity = receiptQuantity;
    }

    public BigDecimal getReceiptPaid() {
        return receiptPaid;
    }

    public void setReceiptPaid(BigDecimal receiptPaid) {
        this.receiptPaid = receiptPaid;
    }

    public BigDecimal getReceiptUnpaid() {
        return receiptUnpaid;
    }

    public void setReceiptUnpaid(BigDecimal receiptUnpaid) {
        this.receiptUnpaid = receiptUnpaid;
    }

    public MasterUser getReceiptUserId() {
        return receiptUserId;
    }

    public void setReceiptUserId(MasterUser receiptUserId) {
        this.receiptUserId = receiptUserId;
    }

    public MasterUnit getReceiptUnitId() {
        return receiptUnitId;
    }

    public void setReceiptUnitId(MasterUnit receiptUnitId) {
        this.receiptUnitId = receiptUnitId;
    }

    public PosMasterUnit getReceiptPosUnitId() {
        return receiptPosUnitId;
    }

    public void setReceiptPosUnitId(PosMasterUnit receiptPosUnitId) {
        this.receiptPosUnitId = receiptPosUnitId;
    }

    public PosMasterRegional getReceiptRegionalId() {
        return receiptRegionalId;
    }

    public void setReceiptRegionalId(PosMasterRegional receiptRegionalId) {
        this.receiptRegionalId = receiptRegionalId;
    }

    public PosTransactionMkWorkOrder getReceiptWorkOrderId() {
        return receiptWorkOrderId;
    }

    public void setReceiptWorkOrderId(PosTransactionMkWorkOrder receiptWorkOrderId) {
        this.receiptWorkOrderId = receiptWorkOrderId;
    }
    

//    public PosTransactionMkRequestMaterialToWarehouse getReceiptRequestId() {
//        return receiptRequestId;
//    }
//
//    public void setReceiptRequestId(PosTransactionMkRequestMaterialToWarehouse receiptRequestId) {
//        this.receiptRequestId = receiptRequestId;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (receiptId != null ? receiptId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionMkReceiptProduction)) {
            return false;
        }
        PosTransactionMkReceiptProduction other = (PosTransactionMkReceiptProduction) object;
        if ((this.receiptId == null && other.receiptId != null) || (this.receiptId != null && !this.receiptId.equals(other.receiptId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return receiptNumber;
//        return "com.ronsicecream.pos.entities.PosTransactionMkReceiptProduction[ receiptId=" + receiptId + " ]";
    }
    
}
